package sysu.el.audit;

/*
 * Easy to use.
 */
public class AuditDbl {
	public double min, max;
	public int num;
	public double sum;
	public AuditDbl(){
		min = Double.MAX_VALUE;
		max = Double.MIN_VALUE;
	}
	public void sample(double value){
		min = Math.min(value, min);
		max = Math.max(value, max);
		sum += value;
		num ++;
	}
	
	public void sample(double[] values){
		for (double e:values) sample(e);
	}
	
	public void sample(Double[] values){
		for (Double e:values) sample(e);
	}
	
	public double getAvg(){
		return (sum / (double)num);
	}
	public double getSum(){
		return sum;
	}
	public double getMin(){
		return min;
	}
	public double getMax(){
		return max;
	}
	
}
